<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Document</title>
		<script type="text/javascript">
			//自定义执行信息删除提示判断，参数uu是成功的删除url地址
			function doDel(uu){
				if(confirm('确定要删除吗？')){
					//网页跳转
					window.location=uu;
				}
			}
		</script>
	</head>
	<body>
		<center>
			<!-- 引用网页首页 -->
			{% include 'myapp/menu.html' %}

			<h2>分页用户信息管理</h2>
			<!-- 搜索功能 -->
			<form action="{% url 'pageusers' 1 %}" method="GET">
				姓名：<input type="text" size="10" name="keyword">
				<input type="submit" value="搜索">
			</form>
			<h3>浏览用户信息</h3>
			<table width="800" border="1">
				<tr>
					<th>ID号</th>
					<th>姓名</th>
					<th>年龄</th>
					<th>电话</th>
					<th>添加时间</th>
					<th>操作</th>
				</tr>
				{% for user in userslist %}
					<tr>
						<td>{{user.id}}</td>
						<td>{{user.name}}</td>
						<td>{{user.age}}</td>
						<td>{{user.phone}}</td>
						<td>{{user.addtime}}</td>
						<td>
							<a href="{% url 'editusers' user.id %}">编辑</a> 
							<a href="javascript:doDel('{% url 'delusers' user.id %}');">删除</a>
						</td>
					</tr>
				{% endfor %}
			</table>
			<br>
			<a href="{% url 'pageusers' pIndex|add:-1 %}{{mywhere}}">上一页</a>
			{% for p in pagelist %}
				{% if pIndex == p %}
					&nbsp;<a href="{% url 'pageusers' p %}{{mywhere}}" style="color: red;">{{p}}</a>
				{% else %}
					&nbsp;<a href="{% url 'pageusers' p %}{{mywhere}}">{{p}}</a>
				{% endif %}
			{% endfor %}
			<a href="{% url 'pageusers' pIndex|add:1 %}{{mywhere}}">下一页</a>
		</center>
	</body>
</html>
